

package com.hazelcast.json.internal;

import com.hazelcast.internal.json.JsonObject;

/**
 * JsonSerializable is a serialization interface that serializes/de-serializes
 * to/from JSON.
 */
public interface JsonSerializable {

    /**
     * Serializes state represented by this object into a {@link JsonObject}.
     *
     * @return the JSON representation of this object
     */
    JsonObject toJson();

    /**
     * Extracts the state from the given {@code json} object and mutates the
     * state of this object.
     *
     * @param json the JSON object carrying state for this object
     */
    void fromJson(JsonObject json);
}
